import javax.swing.*;  
import java.awt.FlowLayout; // 导入 FlowLayout  
import java.awt.event.ActionEvent;  
import java.awt.event.ActionListener;  
  
public class SimpleGUIExample extends JFrame {  
  
    private JLabel label;  
    private JButton button;  
  
    public SimpleGUIExample() {  
        setTitle("简单GUI示例");  
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
        // 使用 FlowLayout 作为布局管理器  
        setLayout(new FlowLayout());  
  
        label = new JLabel("点击按钮改变文本");  
        button = new JButton("点击我");  
  
        add(label);  
        add(button);  
  
        button.addActionListener(new ActionListener() {  
            @Override  
            public void actionPerformed(ActionEvent e) {  
                label.setText("文本已改变！");  
            }  
        });  
  
        setSize(300, 200);  
        setLocationRelativeTo(null);  
        setVisible(true);  
    }  
  
    public static void main(String[] args) {  
        SwingUtilities.invokeLater(new Runnable() {  
            public void run() {  
                new SimpleGUIExample();  
            }  
        });  
    }  
}